<%@ Page Title="Bicycles" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" 
	Inherits="System.Web.Mvc.ViewPage<IEnumerable<GoldenBicycleCompany.Core.QueryDtos.BicycleDto>>" %>
<%@ Import Namespace="GoldenBicycleCompany.Core.QueryDtos" %>
<%@ Import Namespace="GoldenBicycleCompany.Web.Controllers" %>
 

<asp:Content ContentPlaceHolderID="MainContentPlaceHolder" runat="server">

    <h1>Bicycles</h1>

    <% if (ViewContext.TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()] != null) { %>
        <p id="pageMessage"><%= ViewContext.TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()]%></p>
    <% } %>

    <table>
        <thead>
            <tr>
			    <th>BicycleManufacturer</th>
			    <th>BicycleType</th>
			    <th>Color</th>
			    <th>MaintenanceRecords</th>
			    <th>BarcodeIdNumber</th>
			    <th>Model</th>
			    <th>YearPurchased</th>
			    <th>IsRented</th>
			    <th>IsUnderMaintenance</th>
			    <th colspan="3">Action</th>
            </tr>
        </thead>

		<%
		foreach (BicycleDto bicycleDto in ViewData.Model) { %>
			<tr>
				<td><%= bicycleDto.BicycleManufacturer %></td>
				<td><%= bicycleDto.BicycleType %></td>
				<td><%= bicycleDto.Color %></td>
				<td><%= bicycleDto.MaintenanceRecords %></td>
				<td><%= bicycleDto.BarcodeIdNumber %></td>
				<td><%= bicycleDto.Model %></td>
				<td><%= bicycleDto.YearPurchased %></td>
				<td><%= bicycleDto.IsRented %></td>
				<td><%= bicycleDto.IsUnderMaintenance %></td>
				<td><%=Html.ActionLink<BicyclesController>( c => c.Show( bicycleDto.Id ), "Details ") %></td>
				<td><%=Html.ActionLink<BicyclesController>( c => c.Edit( bicycleDto.Id ), "Edit") %></td>
				<td>
    				<% using (Html.BeginForm<BicyclesController>(c => c.Delete(bicycleDto.Id))) { %>
                        <%= Html.AntiForgeryToken() %>
    				    <input type="submit" value="Delete" onclick="return confirm('Are you sure?');" />
                    <% } %>
				</td>
			</tr>
		<%} %>
    </table>

    <p><%= Html.ActionLink<BicyclesController>(c => c.Create(), "Create New Bicycle") %></p>

</asp:Content>
